<?php
require_once('connect.php');
require_once('controller/list-news.php');
if(isset($_GET['fast'])) $fast=1;
	foreach($listnews as $item )
	{
		if(is_array($item))
		{
			if(isset($fast) && $fast==1)
			{
		?>
				 
                     <a href="<?php echo $url.'detail-news/'.$lib->makeTitle($item['title']).'/'.$item['id'] ?>.html">
                     	<img  src="<?php echo $item['image'] ?>" alt=""/>
                        <p><?php  echo $lib->cut_string($item['title'],100); ?></p>
                       
                     </a>
                
		
		<?php	
			}
			else
			{
	?>
	<section class="item-box mainNews">
    
    
		<figure>
			<a href="<?php echo $url.'detail-news/'.$lib->makeTitle($item['title']).'/'.$item['id'] ?>.html">
            	<img width="228" height="160" src="<?php echo $item['image'] ?>" alt=""/>
            </a>
		</figure>
		<section class="info-news">
			<b style="line-height:150%">
			<?php
				if(isset($item['parentid']))
				{
					$cate_title=$lib->selectone("select * from tb_article_category where id =".$item['parentid']);	
					echo  $cate_title->title; 
				}
			 	
			 ?>
             </b><br>
            <?php
				if($item['created'] != '0000-00-00 00:00:00') 
					echo gmdate('d/m/Y H:i:s A ', strtotime($item['created']) + 7*3600);
				else echo '-';
			?>
			<section class="news">
				<h3>
                    <a href="<?php echo $url.'detail-news/'.$lib->makeTitle($item['title']).'/'.$item['id'] ?>.html">
                   	   <?php
					    
							if((strlen($item['title'])>100))
							{
								echo $lib->cut_string($item['title'],100);
							}
							else echo $item['title'];
						
						?>
                    </a>
                </h3>
				<p>
					<?php
						if((strlen($item['description'])>180))
						{
							echo $lib->cut_string($item['description'],180);
						}
						else echo $item['description'] ;
                     ?>
                 </p>
			</section>
		</section>
        
	</section><!--end .item-box-->
	<?php
			}
		}
	}
	
	?>